#pragma once
#include <iostream>
#include <vector>
#include <unordered_map>
#include <functional>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
typedef std::function<void()> func;


std::vector<func> taskset;
std::unordered_map<int,std::string> mp;

void readMySQL()
{
    std::cout << "sub process[" << getpid() << " ] 执行访问数据库的任务\n" << std::endl;
}

void execuleUrl()
{
    std::cout << "sub process[" << getpid() << " ] 执行url解析\n" << std::endl;
}

void cal()
{
    std::cout << "sub process[" << getpid() << " ] 执行加密任务\n" << std::endl;
}

void save()
{
    std::cout << "sub process[" << getpid() << " ] 执行数据持久化任务\n" << std::endl;
}

void load()
{
    mp.insert({taskset.size(),"readMySQL"});
    taskset.push_back(readMySQL);
    mp.insert({taskset.size(),"execuleUrl"});
    taskset.push_back(execuleUrl);
    mp.insert({taskset.size(),"cal"});
    taskset.push_back(cal);
    mp.insert({taskset.size(),"save"});
    taskset.push_back(save);

}

int TaskNum()
{
    return taskset.size();
}